package com.alcatel_lucent.osp.model;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: Guoshun Wu
 * Date: 13-9-7
 * Time: 下午4:51
 */
@Embeddable
public class PageId implements Serializable {
    private Long categoryId;
    private Long typeId;
    private String templateType;


    public PageId() {
    }

    public PageId(Long categoryId, Long typeId, String templateType) {
        this.categoryId = categoryId;
        this.typeId = typeId;
        this.templateType = templateType;
    }

    @Column(name = "TEMPLATE_TYPE", nullable = false)
    public String getTemplateType() {
        return templateType;
    }

    public void setTemplateType(String templateType) {
        this.templateType = templateType;
    }

    @Column(name = "CATEGORY_ID", nullable = false)
    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @Column(name = "TYPE_ID", nullable = false)
    public Long getTypeId() {
        return typeId;
    }

    public void setTypeId(Long typeId) {
        this.typeId = typeId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PageId pageId = (PageId) o;

        if (!categoryId.equals(pageId.categoryId)) return false;
        if (!typeId.equals(pageId.typeId)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = categoryId.hashCode();
        result = 31 * result + typeId.hashCode();
        return result;
    }
}
